;*****************************************************************************************************
;+
; NAME:
;
;      IGL_SetSysVars
;
; PURPOSE:
;
;      This routine is used to set the value of internal private
;      variables needed by the Interactive Graphics Library. It should
;      never be called directly by the user.
;
; CALLING SEQUENCE:
;
;      IGL_SetSysVars, varName, value
;
; ARGUMENTS:
;
;      VARNAME:     The name of the internal variable for which the
;                   caller wants to set the value.
;
;
;      VALUE:       The value corresponding to the internal variable
;                   VARNAME. The variable will be assigned this new value.
;
;                 
; KEYWORD PARAMETERS:
;
;      None.
;
; PACKAGE:
;
;    Interactive Graphics Library (IGL)
;
; AUTHORS:
;
;        RAPHAEL SADOUN
;        Graduate Student
;        Institut d'Astrophysique de Paris
;        98 bis boulevard Arago
;        75014 PARIS FRANCE
;        E-mail: raphael.sadoun@gmail.com
;
;
; MODIFICATION HISTORY:
;
;     Written by: Raphael Sadoun, 24 April 2012
;-
;*****************************************************************************************************
PRO IGL_SetSysVars, VarName, value

  COMPILE_OPT idl2, HIDDEN  
  ON_ERROR, 2
  
  COMMON __IGL_PrivateVars__, privateGlobalObj

  ;; If the CATLIST object is not initialized, issue an error.
  IF (NOT OBJ_VALID(privateGlobalObj)) $
  THEN message, 'IGL internal variables are not initialized. Use IGL_InitSysVars first!'

  ;; Set the new value of the given variable
  sysVar = privateGlobalObj -> Get(VarName)
  IF (NOT obj_valid(sysVar)) THEN message, 'IGL system variable "'+VarName+'" is not defined'
  sysVar -> SetValue, value
  
END
